package com.colin.app.fragment.example;

import com.colin.app.R;
import com.colin.app.app.AppActivity;
import com.colin.app.app.BaseModelImpl;
import com.colin.app.bean.DemoBean;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Colin on 2017/1/15.
 */

public class ExampleModelImpl extends BaseModelImpl implements ExampleContract.ExampleModel {

    private final int[] array_ids = new int[]{
            R.array.ViewDemoBean,
            R.array.MethodDemoBean,
            R.array.SeniorDemoBean,
            R.array.OtherDemoBean,};

    private int fragment_id ;

    public ExampleModelImpl(int fragment_id) {
        this.fragment_id = fragment_id ;
    }

    @Override
    public List<DemoBean> getItemList(AppActivity mAppActivity) {
        String [] demoBeanStringArray= mAppActivity.getResources().getStringArray(array_ids[fragment_id]);
        List<DemoBean> demoBeanList = new ArrayList<>();
        for (String demoBeanString : demoBeanStringArray) {
            demoBeanList.add(new DemoBean(demoBeanString));
        }
        return demoBeanList;
    }
}
